import { Router } from 'express';
import Payload from '../models/Payload';
// import productManager from '../services/ProductManagerService';
import redisUtil from '../lib/RedisUtil';
import RequestUtil from '../lib/RequestUtil';
export default () => {
    let api = Router();
    // putdata测试
    api.post('/postdata', async (req, res, next) => {
        let testdata = req.body;
        console.log( testdata);
        try {
            const test = await new RequestUtil().post(`/seckill/provider/api/v1/`,null,testdata);
            if (test.response.statusCode == 200){
                res.status(200).json(new Payload(test));
            }else{
               throw new Error("something is wrong");
            }    
        } catch (error) {
            next(error);
        }
    });

    return api;
}
